<!doctype html>
<html class="no-js" lang="en, zh-CN" data-content_root="../">
  <head><meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1"/>
    <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Test Javet" href="test.html" /><link rel="prev" title="Build Javet with Docker" href="build_javet_with_docker.html" />

    <link rel="shortcut icon" href="../_static/logo.ico"/><!-- Generated with Sphinx 7.3.6 and Furo 2024.01.29 -->
        <title>Build Javet from Scratch - Javet 3.1.3 documentation</title>
      <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a746c00c" />
    <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?v=135e06be" />
    <link rel="stylesheet" type="text/css" href="../_static/tabs.css?v=4c969af8" />
    <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?v=36a5483c" />
    <link rel="stylesheet" type="text/css" href="../_static/css/custom.css?v=c2631171" />
    
    


<style>
  body {
    --color-code-background: #f8f8f8;
  --color-code-foreground: black;
  
  }
  @media not print {
    body[data-theme="dark"] {
      --color-code-background: #202020;
  --color-code-foreground: #d0d0d0;
  
    }
    @media (prefers-color-scheme: dark) {
      body:not([data-theme="light"]) {
        --color-code-background: #202020;
  --color-code-foreground: #d0d0d0;
  
      }
    }
  }
</style></head>
  <body>
    
    <script>
      document.body.dataset.theme = localStorage.getItem("theme") || "auto";
    </script>
    

<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
  <symbol id="svg-toc" viewBox="0 0 24 24">
    <title>Contents</title>
    <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
      <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
    </svg>
  </symbol>
  <symbol id="svg-menu" viewBox="0 0 24 24">
    <title>Menu</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
      <line x1="3" y1="12" x2="21" y2="12"></line>
      <line x1="3" y1="6" x2="21" y2="6"></line>
      <line x1="3" y1="18" x2="21" y2="18"></line>
    </svg>
  </symbol>
  <symbol id="svg-arrow-right" viewBox="0 0 24 24">
    <title>Expand</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
      <polyline points="9 18 15 12 9 6"></polyline>
    </svg>
  </symbol>
  <symbol id="svg-sun" viewBox="0 0 24 24">
    <title>Light mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
      <circle cx="12" cy="12" r="5"></circle>
      <line x1="12" y1="1" x2="12" y2="3"></line>
      <line x1="12" y1="21" x2="12" y2="23"></line>
      <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
      <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
      <line x1="1" y1="12" x2="3" y2="12"></line>
      <line x1="21" y1="12" x2="23" y2="12"></line>
      <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
      <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
    </svg>
  </symbol>
  <symbol id="svg-moon" viewBox="0 0 24 24">
    <title>Dark mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
      <path stroke="none" d="M0 0h24v24H0z" fill="none" />
      <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
    </svg>
  </symbol>
  <symbol id="svg-sun-half" viewBox="0 0 24 24">
    <title>Auto light/dark mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow">
      <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
      <circle cx="12" cy="12" r="9" />
      <path d="M13 12h5" />
      <path d="M13 15h4" />
      <path d="M13 18h1" />
      <path d="M13 9h4" />
      <path d="M13 6h1" />
    </svg>
  </symbol>
</svg>

<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
<label class="overlay sidebar-overlay" for="__navigation">
  <div class="visually-hidden">Hide navigation sidebar</div>
</label>
<label class="overlay toc-overlay" for="__toc">
  <div class="visually-hidden">Hide table of contents sidebar</div>
</label>



<div class="page">
  <header class="mobile-header">
    <div class="header-left">
      <label class="nav-overlay-icon" for="__navigation">
        <div class="visually-hidden">Toggle site navigation sidebar</div>
        <i class="icon"><svg><use href="#svg-menu"></use></svg></i>
      </label>
    </div>
    <div class="header-center">
      <a href="../index.html"><div class="brand">Javet 3.1.3 documentation</div></a>
    </div>
    <div class="header-right">
      <div class="theme-toggle-container theme-toggle-header">
        <button class="theme-toggle">
          <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
          <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
          <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
          <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
        </button>
      </div>
      <label class="toc-overlay-icon toc-header-icon" for="__toc">
        <div class="visually-hidden">Toggle table of contents sidebar</div>
        <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
      </label>
    </div>
  </header>
  <aside class="sidebar-drawer">
    <div class="sidebar-container">
      
      <div class="sidebar-sticky"><a class="sidebar-brand" href="../index.html">
  
  <div class="sidebar-logo-container">
    <img class="sidebar-logo" src="../_static/logo.png" alt="Logo"/>
  </div>
  
  <span class="sidebar-brand-text">Javet 3.1.3 documentation</span>
  
</a><form class="sidebar-search-container" method="get" action="../search.html" role="search">
  <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
  <input type="hidden" name="check_keywords" value="yes">
  <input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
  <ul class="current">
<li class="toctree-l1 has-children"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of Tutorial</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../tutorial/basic/index.html">Basic</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle navigation of Basic</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/installation.html">Installation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/hello_javet.html">Hello Javet</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/javet_shell.html">Javet Shell</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/interception.html">Interception</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/engine_pool.html">Javet Engine Pool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/node_js_mode_and_v8_mode.html">Node.js Mode and V8 Mode</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/spring_integration.html">Spring Integration</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/polyfill.html">Polyfill</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../tutorial/advanced/index.html">Advanced</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><div class="visually-hidden">Toggle navigation of Advanced</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/advanced/interact_with_node_js.html">Interact with Node.js</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/advanced/object_converter.html">Object Converter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/advanced/java_and_javascript_interop.html">Java and JavaScript Interop</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/advanced/access_the_whole_jvm.html">Access the Whole JVM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/advanced/expose_json_node_in_v8.html">Expose JsonNode in V8</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../tutorial/migration_guides/index.html">Migration Guides</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" role="switch" type="checkbox"/><label for="toctree-checkbox-4"><div class="visually-hidden">Toggle navigation of Migration Guides</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/migration_guides/migrate_from_j2v8.html">Migrate from J2V8</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../reference/index.html">Reference</a><input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" role="switch" type="checkbox"/><label for="toctree-checkbox-5"><div class="visually-hidden">Toggle navigation of Reference</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../reference/javadoc/index.html">API Reference</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../reference/v8_values/index.html">V8 Values</a><input class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" role="switch" type="checkbox"/><label for="toctree-checkbox-6"><div class="visually-hidden">Toggle navigation of V8 Values</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/v8_values/v8_collection.html">V8 Collection</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/v8_values/v8_function.html">V8 Function</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/v8_values/v8_promise.html">V8 Promise</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../reference/converters/index.html">Converters</a><input class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" role="switch" type="checkbox"/><label for="toctree-checkbox-7"><div class="visually-hidden">Toggle navigation of Converters</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/converters/primitive_converter.html">Primitive Converter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/converters/object_converter.html">Object Converter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/converters/proxy_converter.html">Proxy Converter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/converters/bridge_converter.html">Bridge Converter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/converters/custom_converter.html">Custom Converter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/converters/proxy_plugins.html">Proxy Plugins</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../reference/resource_management/index.html">Resource Management</a><input class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" role="switch" type="checkbox"/><label for="toctree-checkbox-8"><div class="visually-hidden">Toggle navigation of Resource Management</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/resource_management/load_and_unload.html">Load and Unload</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/resource_management/lock.html">Know the Lock</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/resource_management/memory_management.html">Memory Management</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/resource_management/modularization.html">Modularization</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/resource_management/snapshot.html">Snapshot</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../reference/troubleshooting/index.html">Troubleshooting</a><input class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" role="switch" type="checkbox"/><label for="toctree-checkbox-9"><div class="visually-hidden">Toggle navigation of Troubleshooting</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/troubleshooting/error_codes.html">Error Codes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/troubleshooting/logging.html">Logging</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/troubleshooting/termination.html">Termination</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../reference/tips/index.html">Tips</a><input class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" role="switch" type="checkbox"/><label for="toctree-checkbox-10"><div class="visually-hidden">Toggle navigation of Tips</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/tips/best_practices.html">Best Practices</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/todo_list.html">TODO List</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../release_notes/index.html">Release Notes</a><input class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" role="switch" type="checkbox"/><label for="toctree-checkbox-11"><div class="visually-hidden">Toggle navigation of Release Notes</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../release_notes/release_notes_3_1.html">Release Notes 3.1.x</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../faq/index.html">FAQ</a><input class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" role="switch" type="checkbox"/><label for="toctree-checkbox-12"><div class="visually-hidden">Toggle navigation of FAQ</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../faq/background/index.html">Background</a><input class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" role="switch" type="checkbox"/><label for="toctree-checkbox-13"><div class="visually-hidden">Toggle navigation of Background</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../faq/background/history_with_j2v8.html">History with J2V8</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/background/what_is_the_motivation.html">What is the Motivation?</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../faq/development/index.html">Development</a><input class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" role="switch" type="checkbox"/><label for="toctree-checkbox-14"><div class="visually-hidden">Toggle navigation of Development</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../faq/development/can_native_image_be_supported.html">Can Native Image be Supported?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/development/how_to_think_in_javet.html">How to Think in Javet?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/development/where_are_es6_api_in_v8_mode.html">Where are ES6 API in V8 Mode?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/development/where_are_the_examples.html">Where are the Examples?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/development/why_is_the_inspector_disabled_in_node_js_mode.html">Why is the Inspector Disabled in Node.js Mode?</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../faq/environment/index.html">Environment</a><input class="toctree-checkbox" id="toctree-checkbox-15" name="toctree-checkbox-15" role="switch" type="checkbox"/><label for="toctree-checkbox-15"><div class="visually-hidden">Toggle navigation of Environment</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../faq/environment/can_javet_support_legacy_linux.html">Can Javet Support Legacy Linux?</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../faq/troubleshooting/index.html">Troubleshooting</a><input class="toctree-checkbox" id="toctree-checkbox-16" name="toctree-checkbox-16" role="switch" type="checkbox"/><label for="toctree-checkbox-16"><div class="visually-hidden">Toggle navigation of Troubleshooting</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../faq/troubleshooting/a_dynamic_link_library_dll_initialization_routine_failed.html">A dynamic link library (DLL) initialization routine failed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/troubleshooting/can_i18n_be_supported.html">Can i18n be Supported?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/troubleshooting/can_i_debug_javet_in_chrome_dev_tools.html">Can I Debug Javet in Chrome DevTools?</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/troubleshooting/sigsegv_at_createv8runtime_in_v8_mode_on_aws.html">SIGSEGV at createV8Runtime() in V8 Mode on AWS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../faq/troubleshooting/why_node_js_crashes_when_being_closed.html">Why Node.js Crashes When being Closed?</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1 current has-children"><a class="reference internal" href="index.html">Development</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-17" name="toctree-checkbox-17" role="switch" type="checkbox"/><label for="toctree-checkbox-17"><div class="visually-hidden">Toggle navigation of Development</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="tools.html">Development Tools</a></li>
<li class="toctree-l2 current has-children"><a class="reference internal" href="build.html">Build Javet</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-18" name="toctree-checkbox-18" role="switch" type="checkbox"/><label for="toctree-checkbox-18"><div class="visually-hidden">Toggle navigation of Build Javet</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="build_javet_with_docker.html">Build Javet with Docker</a></li>
<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">Build Javet from Scratch</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="test.html">Test Javet</a></li>
<li class="toctree-l2"><a class="reference internal" href="design.html">Javet Design</a></li>
<li class="toctree-l2"><a class="reference internal" href="performance.html">Javet Performance</a></li>
<li class="toctree-l2"><a class="reference internal" href="debug_with_chrome_developer_tools.html">Debug with Chrome Developer Tools</a></li>
</ul>
</li>
</ul>

</div>
</div>

      </div>
      
    </div>
  </aside>
  <div class="main">
    <div class="content">
      <div class="article-container">
        <a href="#" class="back-to-top muted-link">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
          </svg>
          <span>Back to top</span>
        </a>
        <div class="content-icon-container">
          
<div class="theme-toggle-container theme-toggle-content">
            <button class="theme-toggle">
              <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
              <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
              <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
              <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
            </button>
          </div>
          <label class="toc-overlay-icon toc-content-icon" for="__toc">
            <div class="visually-hidden">Toggle table of contents sidebar</div>
            <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
          </label>
        </div>
        <article role="main">
          <section id="build-javet-from-scratch">
<h1>Build Javet from Scratch<a class="headerlink" href="#build-javet-from-scratch" title="Link to this heading">¶</a></h1>
<section id="build-v8">
<h2>Build V8<a class="headerlink" href="#build-v8" title="Link to this heading">¶</a></h2>
<p>Please follow the <a class="reference external" href="https://v8.dev/docs/build">official guide</a> to build V8. If you face any issues, you may contact <a class="reference external" href="https://twitter.com/sjtucaocao">&#64;sjtucaocao</a>.</p>
<section id="prepare-v8">
<h3>Prepare V8<a class="headerlink" href="#prepare-v8" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Clone the source code.</p></li>
<li><p>Checkout a proper version.</p></li>
</ul>
<p>Also, please make sure <code class="docutils literal notranslate"><span class="pre">args.gn</span></code> file looks like the following.</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1">; arm64</span>

<span class="na">is_debug</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">target_cpu</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;arm64&quot;</span>
<span class="na">v8_monolithic</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
<span class="na">v8_use_external_startup_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">is_component_build</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_enable_i18n_support</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_enable_pointer_compression</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_static_library</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
<span class="na">symbol_level</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0</span>
<span class="na">use_custom_libcxx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_enable_sandbox</span><span class="o">=</span><span class="s">false</span>

<span class="c1">; x86_64</span>

<span class="na">is_debug</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">target_cpu</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;x64&quot;</span>
<span class="na">v8_monolithic</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
<span class="na">v8_use_external_startup_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">is_component_build</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_enable_i18n_support</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_enable_pointer_compression</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_static_library</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
<span class="na">symbol_level</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0</span>
<span class="na">use_custom_libcxx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
<span class="na">v8_enable_sandbox</span><span class="o">=</span><span class="s">false</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<ul class="simple">
<li><p>To enable i18n support, please set <code class="docutils literal notranslate"><span class="pre">v8_enable_i18n_support</span> <span class="pre">=</span> <span class="pre">true</span></code>.</p></li>
</ul>
</div>
</section>
<section id="build-v8-for-linux-arm64">
<h3>Build V8 for Linux arm64<a class="headerlink" href="#build-v8-for-linux-arm64" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">DEPOT_TOOLS_HOME</span><span class="si">}</span>:<span class="nv">$PATH</span>
<span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">V8_HOME</span><span class="si">}</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm64.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>./
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm64.release<span class="w"> </span>v8_monolith
</pre></div>
</div>
</section>
<section id="build-v8-for-linux-x86-64">
<h3>Build V8 for Linux x86_64<a class="headerlink" href="#build-v8-for-linux-x86-64" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">DEPOT_TOOLS_HOME</span><span class="si">}</span>:<span class="nv">$PATH</span>
<span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">V8_HOME</span><span class="si">}</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>./
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
</pre></div>
</div>
</section>
<section id="build-v8-for-mac-os-arm64">
<h3>Build V8 for Mac OS arm64<a class="headerlink" href="#build-v8-for-mac-os-arm64" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">DEPOT_TOOLS_HOME</span><span class="si">}</span>:<span class="nv">$PATH</span>
<span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">V8_HOME</span><span class="si">}</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm64.release<span class="w"> </span>v8_monolith
</pre></div>
</div>
</section>
<section id="build-v8-for-mac-os-x86-64">
<h3>Build V8 for Mac OS x86_64<a class="headerlink" href="#build-v8-for-mac-os-x86-64" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">DEPOT_TOOLS_HOME</span><span class="si">}</span>:<span class="nv">$PATH</span>
<span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">V8_HOME</span><span class="si">}</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
</pre></div>
</div>
</section>
<section id="build-v8-for-windows">
<h3>Build V8 for Windows<a class="headerlink" href="#build-v8-for-windows" title="Link to this heading">¶</a></h3>
<div class="admonition caution">
<p class="admonition-title">Caution</p>
<p>The patch script requires Python 3.</p>
</div>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">set</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span>%DEPOT_TOOLS_HOME%<span class="p">;</span>%PATH%
<span class="nb">set</span><span class="w"> </span><span class="nv">DEPOT_TOOLS_WIN_TOOLCHAIN</span><span class="o">=</span><span class="m">0</span>
<span class="nb">cd</span><span class="w"> </span>%V8_HOME%
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
python<span class="w"> </span>%JAVET_HOME%<span class="se">\s</span>cripts<span class="se">\p</span>ython<span class="se">\p</span>atch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>.<span class="se">\</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
gn<span class="w"> </span>gen<span class="w"> </span>--ide<span class="o">=</span>vs<span class="w"> </span>out.gn<span class="se">\x</span><span class="m">64</span>.solution
</pre></div>
</div>
</section>
<section id="build-v8-for-android">
<h3>Build V8 for Android<a class="headerlink" href="#build-v8-for-android" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">DEPOT_TOOLS_HOME</span><span class="si">}</span>:<span class="nv">$PATH</span>
<span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">V8_HOME</span><span class="si">}</span>
python3<span class="w"> </span>tools/dev/v8gen.py<span class="w"> </span>arm.release<span class="w"> </span>--<span class="w"> </span><span class="s1">&#39;target_os=&quot;android&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;target_cpu=&quot;arm&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;v8_target_cpu=&quot;arm&quot;&#39;</span><span class="w"> </span><span class="nv">v8_monolithic</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">v8_use_external_startup_data</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">is_component_build</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_i18n_support</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_pointer_compression</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_static_library</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">symbol_level</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">use_custom_libcxx</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_sandbox</span><span class="o">=</span><span class="nb">false</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>./
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span>tools/dev/v8gen.py<span class="w"> </span>arm64.release<span class="w"> </span>--<span class="w"> </span><span class="s1">&#39;target_os=&quot;android&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;target_cpu=&quot;arm64&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;v8_target_cpu=&quot;arm64&quot;&#39;</span><span class="w"> </span><span class="nv">v8_monolithic</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">v8_use_external_startup_data</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">is_component_build</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_i18n_support</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_pointer_compression</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_static_library</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">symbol_level</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">use_custom_libcxx</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_sandbox</span><span class="o">=</span><span class="nb">false</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm64.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>./
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/arm64.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span>tools/dev/v8gen.py<span class="w"> </span>ia32.release<span class="w"> </span>--<span class="w"> </span><span class="s1">&#39;target_os=&quot;android&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;target_cpu=&quot;x86&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;v8_target_cpu=&quot;x86&quot;&#39;</span><span class="w"> </span><span class="nv">v8_monolithic</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">v8_use_external_startup_data</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">is_component_build</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_i18n_support</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_pointer_compression</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_static_library</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">symbol_level</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">use_custom_libcxx</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_sandbox</span><span class="o">=</span><span class="nb">false</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/ia32.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>./
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/ia32.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span>tools/dev/v8gen.py<span class="w"> </span>x64.release<span class="w"> </span>--<span class="w"> </span><span class="s1">&#39;target_os=&quot;android&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;target_cpu=&quot;x64&quot;&#39;</span><span class="w"> </span><span class="s1">&#39;v8_target_cpu=&quot;x64&quot;&#39;</span><span class="w"> </span><span class="nv">v8_monolithic</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">v8_use_external_startup_data</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">is_component_build</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_i18n_support</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_pointer_compression</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_static_library</span><span class="o">=</span><span class="nb">true</span><span class="w"> </span><span class="nv">symbol_level</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">use_custom_libcxx</span><span class="o">=</span><span class="nb">false</span><span class="w"> </span><span class="nv">v8_enable_sandbox</span><span class="o">=</span><span class="nb">false</span>
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_v8_build.py<span class="w"> </span>-p<span class="w"> </span>./
ninja<span class="w"> </span>-C<span class="w"> </span>out.gn/x64.release<span class="w"> </span>v8_monolith
</pre></div>
</div>
</section>
<section id="why-patching-v8">
<h3>Why Patching V8?<a class="headerlink" href="#why-patching-v8" title="Link to this heading">¶</a></h3>
<p>A few ninja files set certain warnings as errors so that MSVC stops compilation. The patch is to turn off those errors.</p>
</section>
</section>
<section id="build-node-js">
<h2>Build Node.js<a class="headerlink" href="#build-node-js" title="Link to this heading">¶</a></h2>
<p>Please follow <a class="reference external" href="https://github.com/nodejs/node/blob/master/BUILDING.md">Building Node.js</a> to build the static and LTS version of Node.js libraries.</p>
<section id="prepare-node-js">
<h3>Prepare Node.js<a class="headerlink" href="#prepare-node-js" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Clone the source code.</p></li>
<li><p>Checkout a proper version.</p></li>
</ul>
</section>
<section id="build-node-js-on-linux">
<h3>Build Node.js on Linux<a class="headerlink" href="#build-node-js-on-linux" title="Link to this heading">¶</a></h3>
<div class="admonition caution">
<p class="admonition-title">Caution</p>
<p>The patch script requires Python 3.</p>
</div>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">NODE_HOME</span><span class="si">}</span>
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_node_build.py<span class="w"> </span>-p<span class="w"> </span><span class="si">${</span><span class="nv">NODE_HOME</span><span class="si">}</span>
./configure<span class="w"> </span>--enable-static<span class="w"> </span>--without-intl
python3<span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/scripts/python/patch_node_build.py<span class="w"> </span>-p<span class="w"> </span><span class="si">${</span><span class="nv">NODE_HOME</span><span class="si">}</span>
make<span class="w"> </span>-j4
</pre></div>
</div>
</section>
<section id="why-patching-node-js">
<h3>Why Patching Node.js?<a class="headerlink" href="#why-patching-node-js" title="Link to this heading">¶</a></h3>
<ul>
<li><p>First patch: All static node libraries are <code class="docutils literal notranslate"><span class="pre">&lt;thin&gt;</span></code> libraries. The patch is to disable <code class="docutils literal notranslate"><span class="pre">&lt;thin&gt;</span></code>.</p></li>
<li><p>Second patch: Many static node libraries are not compiled to <a class="reference external" href="https://en.wikipedia.org/wiki/Position-independent_code">position independent code</a> and link phase is broken with the following error. The patch is to set <code class="docutils literal notranslate"><span class="pre">-fPIC</span></code> to those make files.</p>
<blockquote>
<div><p>/usr/bin/ld: /....../out/Release/libnode.a(node_binding.o):
relocation R_X86_64_TPOFF32 against <code class="docutils literal notranslate"><span class="pre">_ZN4nodeL23thread_local_modpendingE</span></code>
can not be used when making a shared object;
recompile with -fPIC</p>
</div></blockquote>
</li>
</ul>
</section>
<section id="build-node-js-on-mac-os">
<h3>Build Node.js on Mac OS<a class="headerlink" href="#build-node-js-on-mac-os" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">NODE_HOME</span><span class="si">}</span>
./configure<span class="w"> </span>--enable-static<span class="w"> </span>--without-intl
make<span class="w"> </span>-j4
</pre></div>
</div>
</section>
<section id="build-node-js-on-windows">
<h3>Build Node.js on Windows<a class="headerlink" href="#build-node-js-on-windows" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>%NODE_HOME%
vcbuild.bat<span class="w"> </span>static<span class="w"> </span>without-intl<span class="w"> </span>vs2022
</pre></div>
</div>
</section>
</section>
<section id="build-javet">
<h2>Build Javet<a class="headerlink" href="#build-javet" title="Link to this heading">¶</a></h2>
<p>Once Node.js and V8 are ready, please navigate to <code class="docutils literal notranslate"><span class="pre">${JAVET_HOME}/cpp</span></code>, make sure CMake is accessible and execute corresponding build script.</p>
<div class="table-wrapper docutils container">
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>OS</p></th>
<th class="head"><p>Node.js Command</p></th>
<th class="head"><p>V8 Command</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Linux arm64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">build-linux-arm64.sh</span> <span class="pre">-DNODE_DIR=${NODE_HOME}</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">build-linux-arm64.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Linux x86_64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">build-linux-x86_64.sh</span> <span class="pre">-DNODE_DIR=${NODE_HOME}</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">build-linux-x86_64.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Mac OS</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">build-macos.sh</span> <span class="pre">-DNODE_DIR=${NODE_HOME}</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">build-macos.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Windows</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">build-windows.cmd</span> <span class="pre">-DNODE_DIR=%NODE_HOME%</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">build-windows.cmd</span> <span class="pre">-DV8_DIR=%V8_HOME%</span></code></p></td>
</tr>
</tbody>
</table>
</div>
<p>After a while, the following libraries will be placed in folder <code class="docutils literal notranslate"><span class="pre">${JAVET_HOME}/src/main/resources</span></code>.</p>
<div class="table-wrapper docutils container">
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>OS</p></th>
<th class="head"><p>Node.js Library</p></th>
<th class="head"><p>V8 Library</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Linux arm64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-node-linux-arm64.v.*.*.*.so</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-v8-linux-arm64.v.*.*.*.so</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Linux x86_64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-node-linux-x86_64.v.*.*.*.so</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-v8-linux-x86_64.v.*.*.*.so</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Mac OS arm64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-node-macos-arm64.v.*.*.*.dylib</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-v8-macos-arm64.v.*.*.*.dylib</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Mac OS x86_64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-node-macos-x86_64.v.*.*.*.dylib</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-v8-macos-x86_64.v.*.*.*.dylib</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Windows</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-node-windows-x86_64.v.*.*.*.dll</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">libjavet-v8-windows-x86_64.v.*.*.*.dll</span></code></p></td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="build-javet-jni-library-for-android">
<h2>Build Javet JNI Library for Android<a class="headerlink" href="#build-javet-jni-library-for-android" title="Link to this heading">¶</a></h2>
<p>Once V8 are ready, please navigate to <code class="docutils literal notranslate"><span class="pre">./cpp</span></code>, make sure CMake is accessible and execute corresponding build script.</p>
<div class="table-wrapper docutils container">
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Arch</p></th>
<th class="head"><p>Command</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>arm</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">./build-android.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span> <span class="pre">-DCMAKE_ANDROID_NDK=${ANDROID_NDK_HOME}</span> <span class="pre">-DCMAKE_ANDROID_ARCH=arm</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>arm64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">./build-android.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span> <span class="pre">-DCMAKE_ANDROID_NDK=${ANDROID_NDK_HOME}</span> <span class="pre">-DCMAKE_ANDROID_ARCH=arm64</span></code></p></td>
</tr>
<tr class="row-even"><td><p>x86</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">./build-android.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span> <span class="pre">-DCMAKE_ANDROID_NDK=${ANDROID_NDK_HOME}</span> <span class="pre">-DCMAKE_ANDROID_ARCH=x86</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>x86_64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">sh</span> <span class="pre">./build-android.sh</span> <span class="pre">-DV8_DIR=${V8_HOME}</span> <span class="pre">-DCMAKE_ANDROID_NDK=${ANDROID_NDK_HOME}</span> <span class="pre">-DCMAKE_ANDROID_ARCH=x86_64</span></code></p></td>
</tr>
</tbody>
</table>
</div>
<p>After a while, the following libraries will be placed in folder <code class="docutils literal notranslate"><span class="pre">${JAVET_HOME}/android/javet-android/src/main/jniLibs</span></code>.</p>
<div class="table-wrapper docutils container">
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Arch</p></th>
<th class="head"><p>Library</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>arm</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">armeabi-v7a/libjavet-v8-android.v.*.*.*.so</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>arm64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">arm64-v8a/libjavet-v8-android.v.*.*.*.so</span></code></p></td>
</tr>
<tr class="row-even"><td><p>x86</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">x86/libjavet-v8-android.v.*.*.*.so</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>x86_64</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">x86_64/libjavet-v8-android.v.*.*.*.so</span></code></p></td>
</tr>
</tbody>
</table>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<ul class="simple">
<li><p>To enable i18n support for V8 mode, please append <code class="docutils literal notranslate"><span class="pre">-DENABLE_I18N</span></code> to the command.</p></li>
</ul>
</div>
</section>
<section id="id1">
<h2>Build Javet<a class="headerlink" href="#id1" title="Link to this heading">¶</a></h2>
<section id="build-javet-for-linux-mac-os-and-windows">
<h3>Build Javet for Linux, Mac OS and Windows<a class="headerlink" href="#build-javet-for-linux-mac-os-and-windows" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>
gradle<span class="w"> </span>build<span class="w"> </span><span class="nb">test</span>
</pre></div>
</div>
<p>After a while, <code class="docutils literal notranslate"><span class="pre">javet-*.*.*.jar</span></code> will be placed in folder <code class="docutils literal notranslate"><span class="pre">${JAVET_HOME}/build/libs</span></code>.</p>
</section>
<section id="build-javet-for-android">
<h3>Build Javet for Android<a class="headerlink" href="#build-javet-for-android" title="Link to this heading">¶</a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span><span class="si">${</span><span class="nv">JAVET_HOME</span><span class="si">}</span>/android
gradle<span class="w"> </span>build
</pre></div>
</div>
<p>After a while, <code class="docutils literal notranslate"><span class="pre">javet-android-*.*.*-release.aar</span></code> will be placed in folder <code class="docutils literal notranslate"><span class="pre">${JAVET_HOME}/android/javet-android/build/outputs/aar</span></code>.</p>
</section>
</section>
</section>

        </article>
      </div>
      <footer>
        
        <div class="related-pages">
          <a class="next-page" href="test.html">
              <div class="page-info">
                <div class="context">
                  <span>Next</span>
                </div>
                <div class="title">Test Javet</div>
              </div>
              <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
            </a>
          <a class="prev-page" href="build_javet_with_docker.html">
              <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
              <div class="page-info">
                <div class="context">
                  <span>Previous</span>
                </div>
                
                <div class="title">Build Javet with Docker</div>
                
              </div>
            </a>
        </div>
        <div class="bottom-of-page">
          <div class="left-details">
            <div class="copyright">
                Copyright &#169; 2021-2024. caoccao.com Sam Cao
            </div>
            Made with 
            <a href="https://github.com/pradyunsg/furo">Furo</a>
            
          </div>
          <div class="right-details">
            
          </div>
        </div>
        
      </footer>
    </div>
    <aside class="toc-drawer">
      
      
      <div class="toc-sticky toc-scroll">
        <div class="toc-title-container">
          <span class="toc-title">
            On this page
          </span>
        </div>
        <div class="toc-tree-container">
          <div class="toc-tree">
            <ul>
<li><a class="reference internal" href="#">Build Javet from Scratch</a><ul>
<li><a class="reference internal" href="#build-v8">Build V8</a><ul>
<li><a class="reference internal" href="#prepare-v8">Prepare V8</a></li>
<li><a class="reference internal" href="#build-v8-for-linux-arm64">Build V8 for Linux arm64</a></li>
<li><a class="reference internal" href="#build-v8-for-linux-x86-64">Build V8 for Linux x86_64</a></li>
<li><a class="reference internal" href="#build-v8-for-mac-os-arm64">Build V8 for Mac OS arm64</a></li>
<li><a class="reference internal" href="#build-v8-for-mac-os-x86-64">Build V8 for Mac OS x86_64</a></li>
<li><a class="reference internal" href="#build-v8-for-windows">Build V8 for Windows</a></li>
<li><a class="reference internal" href="#build-v8-for-android">Build V8 for Android</a></li>
<li><a class="reference internal" href="#why-patching-v8">Why Patching V8?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#build-node-js">Build Node.js</a><ul>
<li><a class="reference internal" href="#prepare-node-js">Prepare Node.js</a></li>
<li><a class="reference internal" href="#build-node-js-on-linux">Build Node.js on Linux</a></li>
<li><a class="reference internal" href="#why-patching-node-js">Why Patching Node.js?</a></li>
<li><a class="reference internal" href="#build-node-js-on-mac-os">Build Node.js on Mac OS</a></li>
<li><a class="reference internal" href="#build-node-js-on-windows">Build Node.js on Windows</a></li>
</ul>
</li>
<li><a class="reference internal" href="#build-javet">Build Javet</a></li>
<li><a class="reference internal" href="#build-javet-jni-library-for-android">Build Javet JNI Library for Android</a></li>
<li><a class="reference internal" href="#id1">Build Javet</a><ul>
<li><a class="reference internal" href="#build-javet-for-linux-mac-os-and-windows">Build Javet for Linux, Mac OS and Windows</a></li>
<li><a class="reference internal" href="#build-javet-for-android">Build Javet for Android</a></li>
</ul>
</li>
</ul>
</li>
</ul>

          </div>
        </div>
      </div>
      
      
    </aside>
  </div>
</div><script src="../_static/documentation_options.js?v=f5d3a522"></script>
    <script src="../_static/doctools.js?v=9a2dae69"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/scripts/furo.js?v=32e29ea5"></script>
    <script src="../_static/tabs.js?v=3ee01567"></script>
    </body>
</html>